package com.songshuai.webapi.gateway.config;

import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;
import springfox.documentation.swagger.web.SwaggerResource;
import springfox.documentation.swagger.web.SwaggerResourcesProvider;

import java.util.ArrayList;
import java.util.List;
/**
 * Created by yubo on 2018/12/11.
 */
@Primary
@Component
public class DocumentationConfig implements SwaggerResourcesProvider {

    @Override
    public List<SwaggerResource> get() {

        List resources = new ArrayList<>();
        resources.add(swaggerResource("base", "/base/v2/api-docs", "2.0"));
        resources.add(swaggerResource("permission", "/permission/v2/api-docs", "2.0"));
        resources.add(swaggerResource("login", "/login/v2/api-docs", "2.0"));
        resources.add(swaggerResource("crm", "/crm/v2/api-docs", "2.0"));
        resources.add(swaggerResource("sales-tool", "/sales-tool/v2/api-docs", "2.0"));
        resources.add(swaggerResource("sales-client", "/sales-client/v2/api-docs", "2.0"));
        resources.add(swaggerResource("customer-client", "/customer-client/v2/api-docs", "2.0"));
        resources.add(swaggerResource("pangu-api", "/pangu-api/v2/api-docs", "2.0"));
        return resources;
    }


    private SwaggerResource swaggerResource(String name, String location, String version) {
        SwaggerResource swaggerResource = new SwaggerResource();
        swaggerResource.setName(name);
        swaggerResource.setLocation(location);
        swaggerResource.setSwaggerVersion(version);
        return swaggerResource;
    }

}

